<form class="normal_form" form-role="dialog" onsubmit="return Core.DialogForm(this)" style="padding-top:20px;margin-bottom:0;" autocomplete="off">
    <div class="row" style="margin-top:20px;">
        <div class="field_text">服务销售：</div>
        <input type="text" name="nickname" value="{$res['nickname'] ?? ''}" class="input-text require" style="width:200px;" disabled />
    </div>
    <div class="row" data-key="attn">
        <div class="field_text">服务时长：</div>
        <input id="duration" name="duration" class="input-text time-spinner" min="00:00" max="23:59" value="{$res['duration'] ?? '00:00'}" showSeconds="false" style="width:108px;" placeholder="请配置服务时长" >
    </div>
    <div class="row form-footer-bar">
        <p class="colortip"></p>
        <button class="btn" role="btn-cancel">取消</button>
        <button class="btn btn-primary" type="submit" role="btn-submit">保存</button>
    </div>
</form>
<script type="text/javascript">
Core.DialogForm = function(form){    
    var form = $(form);
    var p = {
        'duration'  : form.find("#duration").val(),
    }
    let t = {
        H : $('#duration').timespinner('getHours'),
        i : $('#duration').timespinner('getMinutes'),
    }
    if (p['duration'] != '' && (!Core.rule('intps',t.H) || !Core.rule('intps',t.i))) {
        form.find("p.colortip").html('请配置服务时长!');return false;
    }
    
    form.find(":button").attr('disabled','disabled');
	$.ajax({type : "POST",dataType: "json",cache : false, url : "{$_G['_mca_'] ?? ''}/id/{$res['id'] ?? ''}?r="+Math.random(),data : p,success: function(data){
	   try{
		   if (data['state'] == 'y'){
			   $("#kordersaler").datagrid('reload');$(form).dialogClose();
		   } else {
			   form.find(":button").removeAttr('disabled');form.find("p.colortip").html(data['msg']);return false;
		   }
	   }catch(e){form.find(":button").removeAttr('disabled');form.find("p.colortip").html('数据提交失败!');return false;}
	}});
	return false;
}
$(function(){
    Core.easyloaderInit();
});
</script>